# Clear memory
rm(list=setdiff(ls(all=TRUE), c(".Random.seed")))
# Clear console
cat("\014")this.script <- rstudioapi::getActiveDocumentContext()$path %>% basename
cat("Script:", this.script)Script: 07_Figure_S1_B.Rmd
gg.get.breaks_by1 <- function(limits) {
a <- floor(limits[1])
b <- ceiling(limits[2])
seq(a, b, by = 1)
}
gg.get.breaks_by2 <- function(limits) {
a <- floor(limits[1])
if (a %% 2 == 1) a <- a - 1
b <- ceiling(limits[2])
if (b %% 2 == 1) b <- b + 1
seq(a, b, by = 2)
}get.gg <- function(mtrx, colum.names, axis.labs, titre,
marker.col.false, marker.col.true="#B20000", marker.alpha=1, ttable) {
ttable2 <- dplyr::select(ttable, PROBEID, SYMBOL, adj.P.Val) %>%
dplyr::group_by(PROBEID) %>%
dplyr::slice(which.min(adj.P.Val)) %>%
dplyr::ungroup(.)
df <- mtrx[,colum.names] %>%
magrittr::set_colnames(axis.labs) %>%
tibble::rownames_to_column("PROBEID")
df2 <- merge(x=ttable2, y=df, by="PROBEID", all.x=FALSE, all.y=TRUE) %>%
dplyr::mutate(p.ok = adj.P.Val <= 0.05) %>%
dplyr::mutate(p.ok = as.character(p.ok)) %>%
dplyr::mutate(p.ok = factor(p.ok, levels=c("FALSE", "TRUE"))) %>%
dplyr::mutate(ID = paste0(SYMBOL, " (", PROBEID, ")")) %>%
dplyr::select(-PROBEID, -SYMBOL, -adj.P.Val) %>%
dplyr::select(ID, everything())
res <- df2 %>%
ggplot(aes_string(x=axis.labs[1], y=axis.labs[2])) +
geom_point(aes(text=ID, color=p.ok), alpha=marker.alpha) + # color=marker.col.false,
# scale_color_discrete(name="p ≤ 0.05") +
scale_color_manual(values=c(marker.col.false, marker.col.true), name="p ≤ 0.05") +
scale_x_continuous(limits =c(min(mtrx), max(mtrx))) +
scale_y_continuous(limits =c(min(mtrx), max(mtrx))) +
geom_abline(intercept = 0, slope = 1, color="grey25") +
geom_abline(intercept = -log2(1.75), slope = 1, color="grey25", linetype="dashed") +
geom_abline(intercept = log2(1.75), slope = 1, color="grey25", linetype="dashed") +
labs(title = titre)
res
}Table includes probe IDs, gene symbols and gene names.
Probe IDs and symbols are not unique (due to gene symbol mapping).
mean.expr.file <- "./data/01_Raw_Data_Processing.Rmd.expr_mean.txt"
matrix.df.mean <- read.table(mean.expr.file, sep="\t", header=T,
stringsAsFactors = FALSE) %>%
dplyr::select(-SYMBOL, -GENENAME) %>%
dplyr::distinct(PROBEID, .keep_all=TRUE) %>%
tibble::column_to_rownames("PROBEID")
cat("File read:", mean.expr.file)File read: ./data/01_Raw_Data_Processing.Rmd.expr_mean.txt
rm(mean.expr.file)# list.files("data")
diff.probes.file <- "./data/02_Suppl_Table_01.Rmd.DEprobes.RDS"
stopifnot(file.exists(diff.probes.file))
test.results.probes <- readRDS(diff.probes.file)
cat("File read:", diff.probes.file)File read: ./data/02_Suppl_Table_01.Rmd.DEprobes.RDS
rm(diff.probes.file)x <- paste(utils::capture.output(str(test.results.probes)), collapse="<br>\n", sep="")
details::details(x, summary="Show summary of DE probes", lang=NULL)List of 4
$ ko.ctrl.vs.wt.ctrl:List of 3
..$ down : chr [1:5] “1419620_at” “1424105_a_at” “1425771_at” “1438390_s_at” …
..$ up : chr [1:4] “1416958_at” “1426230_at” “1426464_at” “1438211_s_at”
..$ total: chr [1:9] “1416958_at” “1419620_at” “1424105_a_at” “1425771_at” …
$ ko.mms.vs.wt.mms :List of 3
..$ down : chr [1:3] “1419620_at” “1424105_a_at” “1438390_s_at”
..$ up : chr “1455530_at”
..$ total: chr [1:4] “1419620_at” “1424105_a_at” “1438390_s_at” “1455530_at”
$ wt.mms.vs.wt.ctrl :List of 3
..$ down : chr [1:584] “1415743_at” “1415802_at” “1415810_at” “1415822_at” …
..$ up : chr [1:232] “1416029_at” “1416108_a_at” “1416235_at” “1416432_at” …
..$ total: chr [1:816] “1415743_at” “1415802_at” “1415810_at” “1415822_at” …
$ ko.mms.vs.ko.ctrl :List of 3
..$ down : chr [1:105] “1415972_at” “1416158_at” “1417020_at” “1417073_a_at” …
..$ up : chr [1:115] “1415817_s_at” “1416100_at” “1416172_at” “1416347_at” …
..$ total: chr [1:220] “1415817_s_at” “1415972_at” “1416100_at” “1416158_at” …
rm(x)# list.files()
tt.file <- "Supplemental_Data_1.xlsx"
stopifnot(file.exists(tt.file))
tt.sheet.names <- openxlsx::getSheetNames(tt.file)
# tt.sheet.names
# "ko.ctrl.vs.wt.ctrl" "ko.mms.vs.wt.mms" "wt.mms.vs.wt.ctrl" "ko.mms.vs.ko.ctrl"
get.xlsx.data <- function(fil, sheet) {
openxlsx::read.xlsx(xlsxFile = fil, sheet=sheet)
}
tt.list <- lapply(tt.sheet.names, function(the.sheet) {
res <- get.xlsx.data(fil=tt.file, sheet=the.sheet) %>%
dplyr::select(PROBEID, SYMBOL, logFC, adj.P.Val)
res
}) %>%
set_names(tt.sheet.names)
cat("File read:", tt.file)File read: Supplemental_Data_1.xlsx
rm(tt.file, tt.sheet.names)y <- paste(utils::capture.output(str(tt.list)), collapse="<br>\n", sep="")
details::details(y, summary="Show summary of toptables list", lang=NULL)List of 4
$ ko.ctrl.vs.wt.ctrl:‘data.frame’: 24491 obs. of 4 variables:
..$ PROBEID : chr [1:24491] “1439200_x_at” “1426464_at” “1438211_s_at” “1455265_a_at” …
..$ SYMBOL : chr [1:24491] “Rhox4b” “Nr1d1” “Dbp” “Rgs16” …
..$ logFC : num [1:24491] 4.19 3.6 3.36 3.33 3.26 …
..$ adj.P.Val: num [1:24491] 0.35717 0.00159 0.04513 0.41762 0.50034 …
$ ko.mms.vs.wt.mms :‘data.frame’: 24491 obs. of 4 variables:
..$ PROBEID : chr [1:24491] “1439200_x_at” “1415905_at” “1434137_x_at” “1448964_at” …
..$ SYMBOL : chr [1:24491] “Rhox4b” “Reg1” “Zg16” “S100g” …
..$ logFC : num [1:24491] 4 3.48 3.42 2.97 2.47 …
..$ adj.P.Val: num [1:24491] 0.0941 0.1387 0.2036 0.1737 0.3266 …
$ wt.mms.vs.wt.ctrl :‘data.frame’: 24491 obs. of 4 variables:
..$ PROBEID : chr [1:24491] “1438211_s_at” “1428942_at” “1455265_a_at” “1449233_at” …
..$ SYMBOL : chr [1:24491] “Dbp” “Mt2” “Rgs16” “Bhlha15” …
..$ logFC : num [1:24491] 4.33 4.23 4.2 4.17 4 …
..$ adj.P.Val: num [1:24491] 0.00214 0.00594 0.01936 0.02318 0.00214 …
$ ko.mms.vs.ko.ctrl :‘data.frame’: 24491 obs. of 4 variables:
..$ PROBEID : chr [1:24491] “1415905_at” “1448964_at” “1418287_a_at” “1434137_x_at” …
..$ SYMBOL : chr [1:24491] “Reg1” “S100g” “Dmbt1” “Zg16” …
..$ logFC : num [1:24491] 4.15 3.91 3.48 3.46 3.39 …
..$ adj.P.Val: num [1:24491] 0.0582 0.0638 0.0832 0.129 0.1372 …
rm(y)wt.ko.down.up <- sort(unique(unlist(test.results.probes)))
stopifnot(!any(is.na(wt.ko.down.up)))
cat("Probes selected:", length(wt.ko.down.up))Probes selected: 980
# matrix.df.mean[1:4,1:4]
mx.wt.ko.down.up <- matrix.df.mean[wt.ko.down.up,]
dim(mx.wt.ko.down.up)gg.6.4 <- get.gg(mtrx=mx.wt.ko.down.up,
colum.names = c("Wt_Ctrl", "Ko_Ctrl"),
axis.labs = c("WT", "KO"),
titre = "Control: Knockout versus Wild-type",
marker.col.false = "#005AB5", # bp[3]
marker.col.true = "#DC3220",
marker.alpha=0.5,
ttable=tt.list$ko.ctrl.vs.wt.ctrl)
gg.6.4b <- gg.6.4 +
theme_classic() +
coord_equal()
ggplotly(gg.6.4b)out.file.pdf <- "Figure_S1_B.pdf"
ggsave(filename=out.file.pdf, plot = gg.6.4b, width = 10, height=10, units = "cm")
cat("Saved:", out.file.pdf)Saved: Figure_S1_B.pdf
cat("Date:", format(Sys.time(), "%a %d-%b-%Y %H:%M:%S"), "<br>\n")Date: Mon 21-Jun-2021 08:46:46
devtools::session_info()─ Session info ────────────────────────────────────────────────────────────────────────────────────
─ Packages ────────────────────────────────────────────────────────────────────────────────────────
package * version date lib source
affy 1.64.0 2019-10-29 [1] Bioconductor
affyio 1.56.0 2019-10-29 [1] Bioconductor
AnnotationDbi * 1.48.0 2019-10-29 [1] Bioconductor
assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.6.1)
Biobase * 2.46.0 2019-10-29 [1] Bioconductor
BiocGenerics * 0.32.0 2019-10-29 [1] Bioconductor
BiocManager 1.30.12 2021-03-28 [1] CRAN (R 3.6.1)
bit 4.0.4 2020-08-04 [1] CRAN (R 3.6.1)
bit64 4.0.5 2020-08-30 [1] CRAN (R 3.6.1)
blob 1.2.1 2020-01-20 [1] CRAN (R 3.6.1)
bslib 0.2.4 2021-01-25 [1] CRAN (R 3.6.1)
cachem 1.0.4 2021-02-13 [1] CRAN (R 3.6.1)
callr 3.6.0 2021-03-28 [1] CRAN (R 3.6.1)
cellranger 1.1.0 2016-07-27 [1] CRAN (R 3.6.1)
cli 2.3.1 2021-02-23 [1] CRAN (R 3.6.1)
clipr 0.7.1 2020-10-08 [1] CRAN (R 3.6.1)
codetools 0.2-16 2018-12-24 [2] CRAN (R 3.6.1)
colorspace 2.0-0 2020-11-11 [1] CRAN (R 3.6.1)
crayon 1.4.1 2021-02-08 [1] CRAN (R 3.6.1)
crosstalk 1.1.1 2021-01-12 [1] CRAN (R 3.6.1)
data.table 1.14.0 2021-02-21 [1] CRAN (R 3.6.1)
DBI 1.1.1 2021-01-15 [1] CRAN (R 3.6.1)
debugme 1.1.0 2017-10-22 [1] CRAN (R 3.6.1)
desc 1.3.0 2021-03-05 [1] CRAN (R 3.6.1)
details 0.2.1 2020-01-12 [1] CRAN (R 3.6.1)
devtools 2.3.2 2020-09-18 [1] CRAN (R 3.6.1)
digest 0.6.27 2020-10-24 [1] CRAN (R 3.6.1)
dplyr * 1.0.5 2021-03-05 [1] CRAN (R 3.6.1)
DT 0.17 2021-01-06 [1] CRAN (R 3.6.1)
ellipsis 0.3.1 2020-05-15 [1] CRAN (R 3.6.1)
evaluate 0.14 2019-05-28 [1] CRAN (R 3.6.1)
fansi 0.4.2 2021-01-15 [1] CRAN (R 3.6.1)
farver 2.1.0 2021-02-28 [1] CRAN (R 3.6.1)
fastmap 1.1.0 2021-01-25 [1] CRAN (R 3.6.1)
fs 1.5.0 2020-07-31 [1] CRAN (R 3.6.1)
generics 0.1.0 2020-10-31 [1] CRAN (R 3.6.1)
ggplot2 * 3.3.3 2020-12-30 [1] CRAN (R 3.6.1)
glue 1.4.2 2020-08-27 [1] CRAN (R 3.6.1)
gridExtra 2.3 2017-09-09 [1] CRAN (R 3.6.1)
gtable 0.3.0 2019-03-25 [1] CRAN (R 3.6.1)
htmltools 0.5.1.1 2021-01-22 [1] CRAN (R 3.6.1)
htmlwidgets 1.5.3 2020-12-10 [1] CRAN (R 3.6.1)
httr 1.4.2 2020-07-20 [1] CRAN (R 3.6.1)
IRanges * 2.20.2 2020-01-13 [1] Bioconductor
jquerylib 0.1.3 2020-12-17 [1] CRAN (R 3.6.1)
jsonlite 1.7.2 2020-12-09 [1] CRAN (R 3.6.1)
knitr 1.31 2021-01-27 [1] CRAN (R 3.6.1)
labeling 0.4.2 2020-10-20 [1] CRAN (R 3.6.1)
lazyeval 0.2.2 2019-03-15 [1] CRAN (R 3.6.1)
lifecycle 1.0.0 2021-02-15 [1] CRAN (R 3.6.1)
limma 3.42.2 2020-02-03 [1] Bioconductor
magrittr * 2.0.1 2020-11-17 [1] CRAN (R 3.6.1)
memoise 2.0.0 2021-01-26 [1] CRAN (R 3.6.1)
mouse430a2.db * 3.2.3 2021-03-28 [1] Bioconductor
munsell 0.5.0 2018-06-12 [1] CRAN (R 3.6.1)
openxlsx 4.2.3 2020-10-27 [1] CRAN (R 3.6.1)
org.Mm.eg.db * 3.10.0 2021-03-28 [1] Bioconductor
pillar 1.5.1 2021-03-05 [1] CRAN (R 3.6.1)
pkgbuild 1.2.0 2020-12-15 [1] CRAN (R 3.6.1)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 3.6.1)
pkgload 1.2.0 2021-02-23 [1] CRAN (R 3.6.1)
plotly * 4.9.3 2021-01-10 [1] CRAN (R 3.6.1)
png 0.1-7 2013-12-03 [1] CRAN (R 3.6.1)
preprocessCore 1.48.0 2019-10-29 [1] Bioconductor
prettyunits 1.1.1 2020-01-24 [1] CRAN (R 3.6.1)
processx 3.5.0 2021-03-23 [1] CRAN (R 3.6.1)
pryr 0.1.4 2018-02-18 [1] CRAN (R 3.6.1)
ps 1.6.0 2021-02-28 [1] CRAN (R 3.6.1)
purrr 0.3.4 2020-04-17 [1] CRAN (R 3.6.1)
R6 2.5.0 2020-10-28 [1] CRAN (R 3.6.1)
RColorBrewer 1.1-2 2014-12-07 [1] CRAN (R 3.6.1)
Rcpp 1.0.6 2021-01-15 [1] CRAN (R 3.6.1)
readxl 1.3.1 2019-03-13 [1] CRAN (R 3.6.1)
remotes 2.2.0 2020-07-21 [1] CRAN (R 3.6.1)
rlang 0.4.10 2020-12-30 [1] CRAN (R 3.6.1)
rmarkdown 2.7 2021-02-19 [1] CRAN (R 3.6.1)
rprojroot 2.0.2 2020-11-15 [1] CRAN (R 3.6.1)
RSQLite 2.2.5 2021-03-27 [1] CRAN (R 3.6.1)
rstudioapi 0.13 2020-11-12 [1] CRAN (R 3.6.1)
S4Vectors * 0.24.4 2020-04-09 [1] Bioconductor
sass 0.3.1 2021-01-24 [1] CRAN (R 3.6.1)
scales * 1.1.1 2020-05-11 [1] CRAN (R 3.6.1)
sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.6.1)
stringi 1.5.3 2020-09-09 [1] CRAN (R 3.6.1)
stringr 1.4.0 2019-02-10 [1] CRAN (R 3.6.1)
superheat * 0.1.0 2017-02-04 [1] CRAN (R 3.6.1)
testthat 3.0.2 2021-02-14 [1] CRAN (R 3.6.1)
tibble 3.1.0 2021-02-25 [1] CRAN (R 3.6.1)
tidyr 1.1.3 2021-03-03 [1] CRAN (R 3.6.1)
tidyselect 1.1.0 2020-05-11 [1] CRAN (R 3.6.1)
usethis 2.0.1 2021-02-10 [1] CRAN (R 3.6.1)
utf8 1.2.1 2021-03-12 [1] CRAN (R 3.6.1)
vctrs 0.3.6 2020-12-17 [1] CRAN (R 3.6.1)
viridisLite 0.3.0 2018-02-01 [1] CRAN (R 3.6.1)
withr 2.4.1 2021-01-26 [1] CRAN (R 3.6.1)
xfun 0.22 2021-03-11 [1] CRAN (R 3.6.1)
xml2 1.3.2 2020-04-23 [1] CRAN (R 3.6.1)
yaml 2.2.1 2020-02-01 [1] CRAN (R 3.6.1)
zip 2.1.1 2020-08-27 [1] CRAN (R 3.6.1)
zlibbioc 1.32.0 2019-10-29 [1] Bioconductor
[1] /homedirs26/sghms/bms/users/anohturf/R/x86_64-pc-linux-gnu-library/3.6
[2] /usr/local/R-3.6.1/library
Note: This analysis requires input data generated by an earlier script.